//
//  BaseTableViewController.swift
//  WeiboSwift
//
//  Created by xiaokui wu on 9/9/16.
//  Copyright © 2016 wxk. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController {
    
    var isLogin = true
    /**访客视图*/
    var visitorView : VisitorView?
    
    
    override func loadView() {
        isLogin ? super.loadView() : setupVisitorView()
    }
    
    private func setupVisitorView() {
        visitorView = VisitorView.visitorView()
        view = visitorView
//        visitorView?.delegate = self
        
        visitorView?.loginButton.addTarget(self, action: #selector(loginBtnClick), forControlEvents: .TouchUpInside)
        visitorView?.registerButton.addTarget(self, action: #selector(registerBtnClick), forControlEvents: .TouchUpInside)
        
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: #selector(registerBtnClick))
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: #selector(loginBtnClick))
    }
    
    @objc private func loginBtnClick()
    {
        Log("loginBtnClick")
    }
    
    @objc private func registerBtnClick()
    {
        Log("registerBtnClick")
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        

        
    }
}
// MARK: - VisitorViewDelegate
//extension BaseTableViewController: VisitorViewDelegate{
//
//    func visitorViewDidClickLoginButton(visitor: VisitorView)
//    {
//        
//    }
//    func visitorViewDidClickRegisterButton(visitor: VisitorView)
//    {
//        
//    }
//
//}